/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package billingServer;

import java.io.Serializable;

/**
 * Represents a single price step for one price interval from startPrice to
 * endPrice.
 *
 * @author Gruppe 95
 */
public class PriceStep implements Serializable {

    private double startPrice;
    private double endPrice;
    private double fixedPrice;
    private double variablePricePercent;

    public PriceStep(double startPrice, double endPrice, double fixedPrice, double variablePricePercent) {
        if (endPrice == 0) {
            endPrice = Double.MAX_VALUE;
        }
        this.startPrice = startPrice;
        this.endPrice = endPrice;
        this.fixedPrice = fixedPrice;
        this.variablePricePercent = variablePricePercent;
    }

    /**
     * Create String-representation of priceStep. Values in one line, separated
     * with tabs.
     *
     * @return
     */
    public String toLine() {
        if (getEndPrice() == Double.MAX_VALUE) {
            return getStartPrice() + "\t" + "\t" + "INFINITY" + "\t" + "\t" + getFixedPrice()
                    + "\t" + "\t" + getVariablePricePercent();
        }
        return getStartPrice() + "\t" + "\t" + getEndPrice() + "\t" + "\t" + getFixedPrice()
                + "\t" + "\t" + getVariablePricePercent();
    }

    /**
     * @return the startPrice
     */
    public double getStartPrice() {
        return startPrice;
    }

    /**
     * @return the endPrice
     */
    public double getEndPrice() {
        return endPrice;
    }

    /**
     * @return the fixedPrice
     */
    public double getFixedPrice() {
        return fixedPrice;
    }

    /**
     * @return the variablePricePercent
     */
    public double getVariablePricePercent() {
        return variablePricePercent;
    }
}
